interface CellData {
  [key: string]: unknown
}

interface VCoursePanelBindings {
  value: {
    cellData: CellData
    weekday: string
    timeSlot: string
  }
}

export default {
  mounted(el: HTMLElement, bindings: VCoursePanelBindings) {
    const removeBtn: HTMLElement | null = el.querySelector('.remove-btn')
    const { cellData, weekday, timeSlot } = bindings.value

    removeBtn?.addEventListener('click', removePanelHandle, false)

    function removePanelHandle(): void {
      delete cellData[`${weekday}-${timeSlot}`]
    }
  }
}
